//
//  CertificatePayTipViewControl.h
//  CommunityNannyO2O
//
//  Created by apple on 15/8/13.
//  Copyright (c) 2015年 Apple. All rights reserved.
//

#import "CertificatePayTipViewControl.h"
#import "APIAdress.h"
#import "MBProgressHUD+YC.h"
#import "MJExtension.h"
#import "AccountTool.h"
#import "AppConfig.h"

@interface CertificatePayTipViewControl()<UIPickerViewDataSource, UIPickerViewDelegate>

@property (weak, nonatomic) IBOutlet UIView *backView;

@end

@implementation CertificatePayTipViewControl

- (void)viewDidLoad {
    [super viewDidLoad];
        
    //手势
    UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tap)];
    
    [self.view addGestureRecognizer:tapGestureRecognizer];
    
    UIView *subView = [self.view viewWithTag:999];
    
    UIView *view11 = [subView viewWithTag:1];
    UIView *view12 = [subView viewWithTag:2];
    UIView *view13 = [subView viewWithTag:0];
    
    UITapGestureRecognizer *tapGestureRecognizer11 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(selectView:)];
    
    [view11 addGestureRecognizer:tapGestureRecognizer11];
    
    UITapGestureRecognizer *tapGestureRecognizer12 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(selectView:)];
    
    [view12 addGestureRecognizer:tapGestureRecognizer12];
    
    UITapGestureRecognizer *tapGestureRecognizer13 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(selectView:)];
    
    [view13 addGestureRecognizer:tapGestureRecognizer13];
}

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

-(void)selectView:(id)sender
{
    UITapGestureRecognizer *singleTap = (UITapGestureRecognizer *)sender;
    
    if ([self.deletage respondsToSelector:@selector(pay:)])
    {
        [self.deletage pay:singleTap.view.tag];
    }
    
    [self dismissViewControllerAnimated:YES completion:nil];
}

-(void)tap
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

-(void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    

}

- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
}

- (IBAction)pay:(id)sender
{
    UIButton *btn = sender;
    
    if ([self.deletage respondsToSelector:@selector(pay:)])
    {
        [self.deletage pay:btn.tag];
    }
    
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (IBAction)cancel:(id)sender
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

-(void)setTitleData:(NSString*)cost
{
//    NSString *text = [NSString stringWithFormat:@"￥%@(证书工本费)", cost];
//
//    NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:text];
//    
//    [str addAttribute:NSForegroundColorAttributeName value:MIDIDefaultColor range:NSMakeRange(0, text.length - 7)];
//    
//    [str addAttribute:NSForegroundColorAttributeName value:UIColorRGBA(118, 118, 118, 1) range:NSMakeRange(text.length - 7, 7)];
//    
//    [str addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"Hiragino Sans GB" size:24.0] range:NSMakeRange(0, text.length - 7)];
//    
//    [str addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"Hiragino Sans GB" size:12.0] range:NSMakeRange(text.length - 7, 7)];
//    
//    self.titleLabel.attributedText = str;
    
    self.titleLabel.text = [NSString stringWithFormat:@"￥%@", cost];
}

@end




















